package com.easyexcel.demo.write.converter;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.format.NumberFormat;

import com.easyexcel.demo.write.converter.CustomStringStringConverter;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

/**
 * 基础数据类.这里的排序和excel里面的排序一致
 *
 * @author Jiaju Zhuang
 **/
@Getter
@Setter
@EqualsAndHashCode
public class ConverterData {
    /**
     * 我想所有的 字符串起前面加上"自定义："三个字
     */
    @ExcelProperty(value = "字符串标题", converter = CustomStringStringConverter.class)
    private String stringData;
    /**
     * 我想写到excel 用年月日的格式
     */
    @DateTimeFormat("yyyy年MM月dd日HH时mm分ss秒")
    @ExcelProperty("日期标题")
    private Date dateData;
    /**
     * 我想写到excel 用百分比表示
     */
//    @NumberFormat("#.##%")
    @NumberFormat(value = "0.00%", roundingMode = RoundingMode.HALF_UP)
    @ExcelProperty(value = "数字double标题")
    private BigDecimal doubleData;

    @NumberFormat("0.##")
    @ExcelProperty(value ="数字BigDecimal标题")
    private BigDecimal bigDecimalData;

    /**
     * 忽略这个字段
     */
    @ExcelIgnore
    @ExcelProperty("忽略标题")
    private String ignoreData;
}
